<?php

namespace app\common\service;
use think\Db;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\DbException;

class ShopService
{

    // 获取热门商品
    /**
     * @throws DbException
     * @throws ModelNotFoundException
     * @throws DataNotFoundException
     */
    public function getHotGoods($limit = 10)
    {
        return Db::name('product')
            ->field(['id', 'store_name', 'image', 'price', 'vip_price','unit_name','is_official'])
            ->where(['is_hot' => 1, 'status' => 1, 'is_show' => 1])
            ->limit($limit)
            ->order('sort desc')
            ->select();
    }

}